package com.xqls.listener;

import com.xqls.util.SqlSessionFactoryUtil;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class InitSqlSessionList implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        System.out.println("sqlsessionfactory init ....");
        SqlSessionFactoryUtil.initSqlFactor();
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        System.out.println("sqlsessionfactory close....");
        SqlSessionFactoryUtil.close();
    }
}
